package cn.wolfcode.luowowo.hotel.service;

import cn.wolfcode.luowowo.hotel.domain.Area;
import cn.wolfcode.luowowo.hotel.domain.StarPrice;
import cn.wolfcode.luowowo.hotel.mapper.AreaMapper;
import cn.wolfcode.luowowo.hotel.mapper.HotelMapper;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
@Service
public class AreaServiceImpl implements IAreaService {
    @Autowired
    private AreaMapper areaMapper;
    @Autowired
    private HotelMapper hotelMapper;

    public List<Area> queryByDestId(Long destId) {
        List<Area> list = areaMapper.selectByDestId(destId);
        List<StarPrice> destAvgPrice = hotelMapper.selectDestAvgPrice(destId);
        list.get(0).setAvgPrice(destAvgPrice);
        return list;
    }
}
